package lab2;

/**
 * <p>Title: FlyTest3</p>
 * <p>Description: CS 235 Lab #2</p>
 *         Example of use of the Airplane_noEncap and Jet_noEncap classes.
 *         This class shows how a non-use of encapsulation can result in
 *         messy results.
 * @author This code is from "Head First Object Oriented Design"
 * @date   February 4th 2013
 * @team   
 */
public class FlyTest3 {

	/**
	 * main method for FlyTest3 - this program prints out 
	 *  speeds for two planes.
	 * @param args
	 */
	public static void main(String[] args) {
		final int JET_SPEED = 212;
		/*
		 * using the "non-encapsulated" versions of Jet and Airplane,
		 * we can set the public data member "speed" from outside 
		 * the class without using the setSpeed and getSpeed methods.
		 */
		
        Jet_noEncap jet1 = new Jet_noEncap(); 	// Since Jet_noEncap inherits from 
        jet1.speed = JET_SPEED;						//	Airplane_noEncap, you can use the
         										//	speed variable from its superclass
         										//	just like it was a part of Jet.
        System.out.println("jet1: " + jet1);

        /* Using Jet with encapsulation. We use the same speed as above and
         * and so we would expect to see the same results.
         */
        Jet jet2 = new Jet();
        jet2.setSpeed(JET_SPEED);
        System.out.println("jet2: " + jet2);

		/*
		 * This program looks OK but it does not work in a consistent way because 
		 * we abandoned encapsulation in one class. In bigger programs such things
		 * can be serious problems.
		 */
	}
}